<template>
  <div>
    <a-upload  :file-list="fileList" :remove="newHandleRemove" :before-upload="newbeforeUpload">
      <a-button>
         <a-icon type="upload" /> 选择文件
      </a-button>
   </a-upload>
  </div>
</template>

<script>
import moment from 'moment'
import { getFXZB, getFXQK, exportExcelQK, exportExcelQH, openingKt } from '@/api/public'
export default {
  props:['id','includeFileName'],
  data() {
    return {
     uploading: false,
     fileList: [],   
    }
  },
  filters: {},
  created() {},
  mounted(){
    
  },
  computed: {},
  methods: {
    moment,
    //文件上传前
    newbeforeUpload(file) {
      let result = ''  
      var str = file.name
      this.fileList =[]
      this.fileList = [...this.fileList, file]    
      str.indexOf(this.includeFileName) == -1 ? result = '文件名称错误' : result = '文件名称正确'  
      this.$emit("fileListChange",this.fileList,result,this.id)      
      return false
    },

    newHandleRemove(file) {
      const index = this.fileList.indexOf(file)
      const newFileList = this.fileList.slice()
      newFileList.splice(index, 1)
      this.fileList = newFileList
      this.$emit("resultChange",'未上传',this.id)
    
    },
   

  },
}
</script>
